package utils;

import java.sql.*;

public class ConexionDB {
	
		private static Connection conexion;
	 
		private static Connection Conectar() throws SQLException {
			 
			try {
				
				Class.forName("oracle.jdbc.driver.OracleDriver");
				Connection connection = null;
				connection = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:oracle", "system", "oracle11g");
				return connection;
				
			} catch (ClassNotFoundException e) {
				e.printStackTrace();
				return null;
			}
			
		}

		public static Connection getConexion(){
			try {
				if (conexion==null)
				{
						conexion = ConexionDB.Conectar();
				}
				return conexion;
			} catch (SQLException e) {
				e.printStackTrace();
				return null;
			}
		}
}

